#include <stdio.h>

#define MAX2(a, b) (a>b? a: b)
#define MIN2(a, b) (a<b? a: b)
#define MID3(a, b, c) MAX2(a,b)>c? MAX2(c, MIN2(a,b)) : MAX2(a,b)

#define TRACE(x...) 
#define PRINT(x...) TRACE(printf(x))

int x, y, z;
int _42;

int main() {
	scanf("%d", &_42);

	for (int i=0; i<_42; i++) {
		scanf("%d %d %d", &x, &y, &z);

		PRINT("%d %d %d\n", x,y,z);
		PRINT("max(x,y) = %d,  max(z, min(x,y)) = %d, min(x,y) = %d\n", MAX2(x,y), MAX2(z,MIN2(x,y)), MIN2(x,y));  

		printf("Case %d: %d\n", i+1, MID3(x,y,z));
	}

	return 0;
}
